{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<Toolbar>
  <ToolbarActions>
    <ToolbarLink @route="vault.cluster.access.oidc.keys.create" @type="add" data-test-oidc-key-create>
      Create key
    </ToolbarLink>
  </ToolbarActions>
</Toolbar>

{{#each this.model as |model|}}
  <LinkedBlock
    class="list-item-row"
    @params={{array "vault.cluster.access.oidc.keys.key.details" model.name}}
    data-test-oidc-key-linked-block={{model.name}}
  >
    <div class="level is-mobile">
      <div class="level-left">
        <div>
          <Icon @name="key" class="has-text-grey-light" />
          <span class="has-text-weight-semibold is-underline" data-test-item>
            {{model.name}}
          </span>
        </div>
      </div>
      <div class="level-right is-flex is-paddingless is-marginless">
        <div class="level-item">
          <Hds::Dropdown @isInline={{true}} @listPosition="bottom-right" as |dd|>
            <dd.ToggleIcon
              @icon="more-horizontal"
              @text="Key nav options"
              @hasChevron={{false}}
              data-test-popup-menu-trigger
            />
            <dd.Interactive
              @route="vault.cluster.access.oidc.keys.key.details"
              @model={{model.name}}
              @disabled={{eq model.canRead false}}
              data-test-oidc-key-menu-link="details"
            >Details</dd.Interactive>
            <dd.Interactive
              @route="vault.cluster.access.oidc.keys.key.edit"
              @model={{model.name}}
              @disabled={{eq model.canEdit false}}
              data-test-oidc-key-menu-link="edit"
            >Edit</dd.Interactive>
          </Hds::Dropdown>
        </div>
      </div>
    </div>
  </LinkedBlock>
{{/each}}